package com.java4;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class FinallyTest {

    public static void main(String[] args) {
        FileInputStream fis = null;
        try {
            File file = new File("hello.txt");//相对路径 ，相当于在当前工程下
            fis = new FileInputStream(file);

            int data = fis.read();
            while (data != -1){
                System.out.print((char)data);
                data = fis.read();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (fis != null){
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
